#include "productdialog.h"
#include "ui_productdialog.h"

productDialog::productDialog(DataBase *mainBase, QWidget *parent)  :
    QDialog(parent),
    ui(new Ui::productDialog)
{
    Base = mainBase;
    ui->setupUi(this);
    ui->lineEdit->setText(Base->name);
    ui->amount_spin->setRange(0,100000000000);
    ui->amount_spin->setValue(Base->amount);
    ui->deadline_spin->setRange(0,100000000000);
    ui->deadline_spin->setValue(Base->deadline);
    ui->time_spin->setRange(0,100000000000);
    ui->time_spin->setValue(Base->dailyProduction);
}

productDialog::~productDialog()
{
    delete ui;
}

void productDialog::on_pushButton_clicked()
{
    Base->name = ui->lineEdit->text();
    Base->amount = ui->amount_spin->value();
    Base ->deadline = ui->deadline_spin->value();
    Base ->dailyProduction = ui->time_spin->value();
    this->close();
}
